using NetChinese.Interfaces;
using System.Diagnostics;

namespace NetChinese.Services
{
    /// <summary>
    /// IntelliSenseLocalizer工具管理器
    /// </summary>
    public class IntelliSenseLocalizerManager : IToolManager
    {
        private readonly ICommandExecutor _commandExecutor;

        public IntelliSenseLocalizerManager(ICommandExecutor commandExecutor)
        {
            _commandExecutor = commandExecutor;
        }

        public async Task<bool> CheckToolInstalledAsync()
        {
            // 使用 dotnet tool list 命令检查工具是否已安装
            return await _commandExecutor.ExecuteCommandAsync("dotnet tool list -g", showOutput: false);
        }

        public async Task<bool> InstallToolAsync()
        {
            Console.WriteLine("正在安装IntelliSenseLocalizer工具...");
            return await _commandExecutor.ExecuteCommandAsync("dotnet tool install -g islocalizer");
        }

        public async Task<bool> UpdateToolAsync()
        {
            Console.WriteLine("正在检查更新...");
            return await _commandExecutor.ExecuteCommandAsync("dotnet tool update -g islocalizer");
        }
    }
} 